package cdu.xjj.controller;

import cdu.xjj.pojo.vo.DashBoardVO;
import cdu.xjj.pojo.vo.PhysicalTestDataReportWorkDetailsVO;
import cdu.xjj.result.Result;
import cdu.xjj.service.DataReportService;
import com.fasterxml.jackson.core.JsonProcessingException;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * 体测工作详情接口
 */
@Slf4j
@RestController
@RequestMapping("/data-report")
@RequiredArgsConstructor
public class DataReportController {

    private final DataReportService dataReportService;

    /**
     * 查询今年的体测上报工作详情
     *
     * @return 统一响应结果
     */
    @GetMapping("/this-year")
    public Result thisYearReportWorkDetails() {
        log.info("获取本年度体测上报工作详情");
        PhysicalTestDataReportWorkDetailsVO physicalTestDataReportWorkDetailsVO = dataReportService.getThisYearWorkDetails();
        return Result.success(physicalTestDataReportWorkDetailsVO);
    }


    /**
     * 根据不同的角色获取dashboard需要的数据
     *
     * @return 统一响应结果
     */
    @GetMapping("/dashboard")
    public Result getDashBoardRequiredDataByRole() throws JsonProcessingException {
        log.info("获取dashboard数据");
        DashBoardVO dashBoardVO = dataReportService.getDashBoardRequiredDataByRole();
        return Result.success(dashBoardVO);
    }





}
